home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-02-25 | 3.4 KB | 164 lines | [TEXT/MPS ] |
- *******************************************************************************
- * IR -- the Init Restarting init/request proc/Finder Extension/Cheese Slicer
- *
- * (C) Copyright Apple Computer, Inc. 1991
- * All rights reserved.
- *
- * by Matt Deatherage
- * 10/31/91
- *
- * This file is the init, called by GS/OS (or IR, in an interesting case of
- * circular installation) to install the request proc that is also the Finder
- * extension. Consequently, this file isn't too huge.
- *
- *
- * Modification History:
- *
- * Version Author
- *
- * 2.0a1 Matt Deatherage 11/18/91 (Happy 25th birthday...)
- * First version of this file.
- *
- * 2.0b1 Matt Deatherage 02/18/91
- * Now appends the user ID to the request procedure name so more than one
- * can exist, at least partially.
- *
- * 2.0 Matt Deatherage 02/25/92
- * Release to the world; no code changes since 2.0b1.
- *
- *
- *******************************************************************************
-
- EJECT
- *******************************************************************************
- *
- IR PROC
- *
- * Description: The init, the entry point. Our user ID is in the
- * accumulator, and a word of zero is at 4,s -- if we change
- * the low bit of that word to 1, we get unloaded when we're
- * done.
- *
- *
- * Inputs: None
- *
- * Outputs: None
- *
- * External Refs:
- IMPORT IRRequestProc
- IMPORT IRString
- IMPORT ID1
- IMPORT ID2
- INCLUDE 'E16.IR'
- INCLUDE 'M16.Memory'
- INCLUDE 'M16.Util2'
- INCLUDE 'M16.Locator'
- INCLUDE 'E16.Locator'
- INCLUDE 'M16.MiscTool'
- INCLUDE 'M16.Loader'
- INCLUDE 'M16.IntMath'
- INCLUDE 'M16.QuickDraw'
- *
- * Entry Points:
- *
- *******************************************************************************
-
- phb
- phk
- plb
-
- ;
- ; First, see if we have QuickDraw version 3.7 or greater to indicate 6.0 or later.
- ;
-
- pha ; space for result
- _QDVersion
- pla
- and #$0FFF ; clear off prototype/other bits (IIgs TN #100)
- cmp #$0307
- bge InstallIR
- brl badIRenv ; bad environment
-
- ;
- ; If we have it, install the request proc
- ;
-
- InstallIR pha
- _MMStartUp
- pla ; for bug in old IR application
- sta initID ; keep a copy of the user ID
-
- ;
- ; The old IR application had a bug in some versions where it didn't necessarily
- ; have the user ID in A before dispatching to an init. So, to be defensive
- ; against my own mistakes, I put the above check in. -MD
- ;
-
- ;
- ; Now, append our user ID in hex form to the string so we can keep more than
- ; one around for a brief time if necessary.
- ;
-
- pha
- pha
- pha ; ID still in A
- _Hexit
-
- pla
- sta ID1
- pla
- sta ID2 ; store inside the string
-
-
- pushlong #IRString
- pushword initID ; now we need this
- pushlong #IRRequestProc
- _AcceptRequests
- bcs badIRenv ; can't install IR
-
- ;
- ; Got it in, so let's send it the startup request. We need a pointer to the user ID.
- ;
-
- pushword #askIRStartUp
- pushword #sendToName
- pushlong #IRString ; the target
- pushlong #initID ; address of the user ID
- lda #0
- pha
- pha ; dataOut == NIL to prevent Tool Locator from using it
- _SendRequest
- bcs badIRenv ; can't start it up
-
- ;
- ; We're done!
- ;
- plb
- rtl ; we're done
-
- ;
- ; Here's the place we go when we can't install.
- ;
-
- badIRenv plb
- lda 4,s
- bne @rtl ; don't change word if not zero!
- ora #$0001
- sta 4,s ; tell GS/OS to shut us down
- @rtl rtl
-
- ;
- ; Static data for the init
- ;
-
- InitID ds.w 1 ; copy of user ID
- dataOutStorage ds.w 1 ; recvCount
- BootIcon ds.l 1 ; icon pointer
- BootString ds.l 1 ; string pointer
-
- srqGoAwayBuffer dc.w 0 ; recvCount
- srqUserID dc.w 0 ; user ID
- srqShutdownFlag dc.w 0 ; shutdown flag
-
- EndP
- END